{% extends "base.html" %}
{% block content %}
</div>
<div class="col-md-12">
<table class="table">
    <tr>
        <th>User</th>
        <th>Platform</th>
        <th>Login Time</th>
        <th>Login IP</th>
        <th>Info</th>
        <th>Action</th>
    </tr>
    {% for user in users %}
    <tr>
        <td>
            <img src='{{user.avatar}}' height=32 width=32 />
            {{user.username}}
        </td>
        <td>{{user.social_auth[0].provider}}</td>
        <td>{{user.access_time}}</td>
        <td>{{user.extra.login_ip}}</td>
        <td>
            {% if user.extra.read_history %} read({{user.extra.read_history|length}}) {% endif %}
            {% if user.extra.push_history %} push({{user.extra.push_history|length}}) {% endif %}
            {% if user.extra.visit_history %} visit({{user.extra.visit_history|length}}) {% endif %}
            {% if user.extra.download_history %} download({{user.extra.download_history|length}}) {% endif %}
        </td>
        <td>
            <a class="btn" href="/admin/set?user_id={{user.id}}">Enter</a>
        </td>
    </tr>
    {% endfor %}
</table>
<ul class="pagination">
    <li {% if page_now == 0 %}class="disabled"{%endif%}><a href="?sort={{sort}}&start={{page_now*delta-delta}}">&laquo; 前页</a></li>

    {% for p in pages %}
    <li {%if page_now == p %}class="active"{%endif%}><a href="?sort={{sort}}&start={{p*delta}}">{{p+1}}</a></li>
    {% endfor %}

    {% if page_max not in pages %}
    <li class="disabled"><a href="#">...</a></li>
    <li><a href="?sort={{sort}}&start={{page_max*delta}}">{{page_max+1}}</a></li>
    {% endif %}

    <li {% if page_now == page_max %}class="disabled"{%endif%}><a href="?sort={{sort}}&start={{page_now*delta+delta}}">后页 &raquo;</a></li>
</ul>
</div>
<div>
{% endblock %}

{% block sidebar %}
{% endblock %}
